feat: add Java framework support#948
Draft
sarahxsanders wants to merge 1 commit into
Draft
Conversation
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
sarahxsanders
force-pushed
the
posthog-code/rust-framework-support
branch
from
July 22, 2026 20:41
700cbba to
6cad9a7
Compare
sarahxsanders
force-pushed
the
posthog-code/java-framework-support
branch
from
July 22, 2026 20:41
ffc03e7 to
de69e22
Compare
sarahxsanders
changed the base branch from
posthog-code/rust-framework-support
to
main
July 22, 2026 20:42
Adds Java (server) as a supported framework, stacked on the Rust framework PR: - Integration.java enum entry ordered after kmp/swift/android — those claim gradle projects first — and before the language fallbacks - JAVA_AGENT_CONFIG in src/frameworks/java/ — claims pom.xml unconditionally (Maven is unambiguously JVM backend) and root gradle files only when they carry no Android/KMP plugin markers and no AndroidManifest.xml subtree exists; gathers buildTool (maven | gradle) as agent context; installs by editing the build file with com.posthog:posthog-server then resolving with mvn install / gradle build - detectJavaPackageManagers detector (Maven via pom.xml, Gradle fallback reusing gradlePackageManager) + FRAMEWORK_REGISTRY entry - No bash-fence changes needed: mvn/mvnw and gradle/gradlew grammars already exist from Android/KMP - Pins framework: java on a new integration-java entry in the variant-resolution contract test, matching context-mill PR #270 which must release before this merges - Marks pom.xml as a real framework target in the agentic manifest comment, leaving .NET as the only manifest without a target Generated-By: PostHog Code Task-Id: 9c949855-7611-48f2-b8b5-7aa4112543e5
sarahxsanders
force-pushed
the
posthog-code/java-framework-support
branch
from
July 22, 2026 20:43
de69e22 to
c8c2d59
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related PRs:
mainand can merge on its own, in any order relative to the sibling Go/Elixir/Rust/Java framework PRs.Adds Java (server) as a supported framework. Java is the one language here whose manifest collides with existing frameworks — Android and KMP both claim gradle projects — so detection is deliberately conservative:
Integration.javaenum entry ordered afterkmp/swift/android(they claim gradle projects first, enforced by a new enum-order test) and before the language fallbacksJAVA_AGENT_CONFIGinsrc/frameworks/java/— claimspom.xmlunconditionally (Maven is unambiguously a JVM backend); claims root gradle files only when they carry no Android/KMP plugin markers and noAndroidManifest.xmlexists anywhere in the tree (mirroring the Android detector's own strategies, so a directdetect()call can never claim their projects); Flutter'spubspec.yamlguard includedgatherContextrecords the build tool (maven|gradle) for analytics tags and the agent promptdetectJavaPackageManagers— a real detector (Maven viapom.xml, otherwise the existinggradlePackageManager); install guidance is manual-edit-then-resolve since neither tool has a single add verb, pinningcom.posthog:posthog-serverfrom Maven Centralposthog-androidis a different library, and covers the client lifecycle (close()on shutdown,flush()in serverless)mvn/mvnwandgradle/gradlewgrammars already exist from Android/KMPframework: javaon a newintegration-javaentry in the variant-resolution contract test, matching the context-mill PR aboveWhy: the wizard docs page lists Java as "Coming soon"; instead of removing the label (posthog.com#18797), we're making the wizard actually support it.
Verification:
pnpm build✅,pnpm test✅ (1560 tests, incl. 7 new java detect cases + enum-order + package-manager detection tests),pnpm fix✅Created with PostHog Code